from django.views.generic import ListView, DetailView
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.core.urlresolvers import reverse_lazy

from invoices.models import PurchaseInvoice


# PURCHASE INVOICES GENERIC CLASS-BASED VIEWS
# -------------------------------------------

class PurchaseInvoiceListView(ListView):
    model = PurchaseInvoice
    paginate_by = 10


class PurchaseInvoiceDetailView(DetailView):
    model = PurchaseInvoice


class PurchaseInvoiceUpdateView(UpdateView):
    model = PurchaseInvoice
    template_name_suffix = '_update_form'


class PurchaseInvoiceCreateView(CreateView):
    model = PurchaseInvoice
    template_name_suffix = '_create_form'


class PurchaseInvoiceDeleteView(DeleteView):
    model = PurchaseInvoice
    template_name_suffix = '_delete_form'
    success_url = reverse_lazy('purchase_invoice_listview')
